import __config from "config/env";
import util from "utils/util";

export const request = (url, method, data, showLoading, isExport) => {
	let _url = url;
	//#ifndef H5
	_url = __config.basePath + url;
	//#endif
	return new Promise((resolve, reject) => {
		if (showLoading) {
			uni.showLoading({
				title: "加载中...",
				mask: true,
			});
		}
		uni.request({
			url: _url,
			method: method,
			data: data,
			withCredentials: true,
			header: {
				//#ifdef H5
				"client-type": util.isWeiXinBrowser() ? "H5-WX" : "H5", //客户端类型普通H5或微信H5
				"tenant-id": getApp().globalData.tenantId,
				"app-id": getApp().globalData.appId ? getApp().globalData.appId : "", //微信h5有appId
				//#endif
				//#ifdef MP-WEIXIN
				"client-type": "MA", //客户端类型小程序
				"app-id": uni.getAccountInfoSync().miniProgram.appId, //小程序appId
				//#endif
				//#ifdef APP-PLUS
				"client-type": "APP", //客户端类型APP
				"tenant-id": 1681960311516827648,
				// "tenant-id": getApp().globalData.tenantId,
				//#endif
				"third-session": uni.getStorageSync("third_session")
					? uni.getStorageSync("third_session")
					: "",
			},
			success(res) {
				if (res.statusCode == 200) {
					if (isExport) {
						resolve(res);
						return;
					}
					if (res.data.code != 0) {
						if (res.data.code == 60001 || res.data.code == 60002) {
							if (!getApp().globalData.logining) {
								getApp().globalData.logining = true; //防止同时多个接口触发登录
								if (util.isMiniPg() || (getApp().globalData.appId && util.isWeiXinBrowser())) {
									//小程序或公众号H5，删除third_session重新登录
									uni.removeStorageSync("third_session");
									getApp()
										.doLogin()
										.then((res) => {
											var pages = getCurrentPages(); // 获取页面栈
											var currPage = pages[pages.length - 1]; // 当前页面
											currPage.onLoad(currPage.options);
											currPage.onShow();
										});
								} else {
									util.backLoginPage();
								}
								setTimeout(function () {
									getApp().globalData.logining = false;
								}, 2000);
							}
							reject("session过期重新登录");
						} else if (res.data.code == 60003) {
							if (!getApp().globalData.logining2) {
								getApp().globalData.logining2 = true; //防止同时多个接口触发登录
								util.backLoginPage();
								setTimeout(function () {
									getApp().globalData.logining2 = false;
								}, 2000);
							}
							else{
								util.backLoginPage();
							}
							reject("请先登录商城");
						} else {
							if (res.data.errCode || res.data.errCode == 0) {
								//兼容im返回
								resolve(res.data);
							} else {
								let errMsg = res.data.msg || res.errMsg;
								console.log('errMsg',errMsg)
								if(errMsg=="该直播已结束，且已经超过回放时间，无法观看。即将跳转首页观看其他直播。"){
									uni.showModal({
										showCancel:false,
										title: '提示',
										content: errMsg,
										success: function (res) {
												if (res.confirm) {
													uni.switchTab({
														url:"/pages/home/index"
													})
												}
											}
									})
								}
								else if(errMsg.replace(/\d+|\s+/g, '')=="还需观看秒才能参与答题"){
								uni.showModal({
									showCancel:false,
									title: '提示',
									content: errMsg,
									success: function (res) {
										console.log(res)
										}
								})
								}
								reject(res.data.msg);
							}
						}
					}
					resolve(res.data);
				} else if (res.statusCode == 404) {
					uni.showModal({
						title: "提示",
						content: "接口请求出错，请检查手机网络",
						success(res) {},
					});
					reject();
				} else if (res.statusCode == 502) {
					console.log(502);
					uni.showModal({
						title: "提示",
						content: "服务器维护中，请稍后再来",
						success(res) {},
					});
					reject();
				} else if (res.statusCode == 503) {
					console.log(503);
					uni.showModal({
						title: "提示",
						content: "503错误，服务未启动",
						success(res) {},
					});
					reject();
				} else if (res.statusCode == 500) {
					uni.showModal({
						title: "提示",
						content: "错误：" + res.data.msg,
						success(res) {},
					});
					reject();
				} else {
					// console.log(res);
					// uni.showModal({
					//     title: '提示',
					//     content: '错误：' + res.data.msg,
					//     success(res) {
					//     }
					// });
					reject();
				}
			},
			fail(error) {
				console.log(error);
				//3提示无网络
				uni.hideLoading();
				if (error.errMsg && error.errMsg.indexOf("statusCode:-1") != -1) {
					console.log("无网络");
				} else if (getApp().globalData.hasNetwork) {
					// 忽略该错误 带有interrupted的 一般都是小程序切后台中断导致的 https://zhuanlan.zhihu.com/p/453875594
					let ignoreErrMsg = "network api interrupted in suspend state";
					if (error.errMsg) {
						if (error.errMsg.indexOf("network api interrupted in suspend state") == -1) {
							uni.showModal({
								title: "提示",
								content: "接口请求出错：" + error.errMsg,
								success(res) {},
							});
						}
					} else {
						uni.showModal({
							title: "提示",
							content: "接口请求出错：" + error,
							success(res) {},
						});
					}
				} else {
					uni.showToast({
						icon: "none",
						title: "无法连接到网络",
					});
				}
				reject(error);
			},
			complete(res) {
				uni.hideLoading();
			},
		});
	});
};

// 登录成功后需要进行的统一操作
const loginSuccess = (request) => {
	return new Promise((resolve, reject) => {
		request
			.then((res) => {
				if (res && res.data.id) {
					// 登录成功
					console.log("************登录成功************");
					let userInfo = res.data;
					uni.setStorageSync("third_session", userInfo.thirdSession);
					uni.setStorageSync("user_info", userInfo);
					// getApp().userOnlineHeartbeat();
				}
				resolve(res);
			})
			.catch((err) => {
				reject(err);
			});
	});
};

// 退出登录后需要进行的统一操作
const logoutSuccess = (request) => {
	return new Promise((resolve, reject) => {
		request
			.then((res) => {
				//退出登录成功
				console.log("************退出登录成功************");
				// getApp().userOnlineHeartbeat(true);
				resolve(res);
			})
			.catch((err) => {
				reject(err);
			});
	});
};

module.exports = {
	request,
	loginWxMa: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//微信小程序登录接口
		// return request('/liveapi/wxuser/loginma', 'post', data, false);
		return loginSuccess(request("/liveapi/wxuser/loginma", "post", data, false));
	},
	loginWxMp: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//微信公众号登录接口
		return loginSuccess(request("/liveapi/wxuser/loginmp", "post", data, false));
	},
	loginByPhoneMa: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//商城通过小程序授权手机号一键登录商城
		return loginSuccess(request("/liveapi/userinfo/ma/phone/login", "post", data, true));
	},
	loginByPhone: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//商城手机验证码登录商城
		return loginSuccess(request("/liveapi/userinfo/phone/login", "post", data, true));
	},
	login: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//商城账号登录
		return loginSuccess(request("/liveapi/userinfo/login", "post", data, true));
	},
	logout: (data) => {
		//商城退出登录
		return logoutSuccess(request("/liveapi/userinfo/logout", "post", data, true));
	},
	touristLogin: (data) => {
		//游客登录
		return request("/liveapi/userinfo/ma/visitor/login", "post", data, false);
	},
	getPhoneCode: (data) => {
		//获取手机验证码
		return request("/liveapi/phone/code", "get", data, true);
	},
	register: (data) => {
		//如果有分享人则带上分享人的user_code
		data = util.dataAddSharerUserCode(data);
		//账号注册
		return request("/liveapi/userinfo/register", "post", data, true);
	},
	updateUserPhone: (data) => {
		//修改商城用户手机号
		return request("/liveapi/userinfo/phone", "post", data, true);
	},
	getJsSdkConfig: (data) => {
		//获取jssdk config参数
		return request("/liveapi/wxjssdk/config", "post", data, false);
	},
	themeMobileGet: () => {
		//获取商城主题装修配置
		return request("/liveapi/thememobile", "get", null, false);
	},
	shopInfoPage: (data) => {
		//店铺列表
		return request("/liveapi/shopinfo/page", "get", data, false);
	},
	shopInfoPageWithSpu: (data) => {
		//店铺列表带商品
		return request("/liveapi/shopinfo/pagewithspu", "get", data, false);
	},
	shopInfoGet: (id) => {
		//店铺查询
		return request("/liveapi/shopinfo/" + id, "get", null, false);
	},
	userInfoUpdateByMa: (data) => {
		//通过微信小程序更新用户信息
		return request("/liveapi/userinfo/ma", "put", data, true);
	},
	userInfoUpdateByMp: (data) => {
		//通过微信公众号网页授权更新用户信息
		return request("/liveapi/userinfo/mp", "put", data, true);
	},
	goodsCategoryTree: (data) => {
		//商城商品分类tree查询
		return request("/liveapi/goodscategory/tree", "get", data, false);
	},
	goodsCategoryShopTree: (data) => {
		//店铺商品分类tree查询
		return request("/liveapi/goodscategoryshop/tree", "get", data, true);
	},
	goodsPage: (data) => {
		//商品列表
		return request("/liveapi/goodsspu/page", "get", data, false);
	},
	goodsGet: (id) => {
		//商品查询
		return request("/liveapi/goodsspu/" + id, "get", null, false);
	},
	goodsSpecGet: (data) => {
		//商品规格查询
		return request("/liveapi/goodsspuspec/tree", "get", data, true);
	},
	shoppingCartPage: (data) => {
		//购物车列表
		return request("/liveapi/shoppingcart/page", "get", data, false);
	},
	shoppingCartAdd: (data) => {
		//购物车新增
		return request("/liveapi/shoppingcart", "post", data, true);
	},
	shoppingCartUpdate: (data) => {
		//购物车修改
		return request("/liveapi/shoppingcart", "put", data, true);
	},
	shoppingCartDel: (data) => {
		//购物车删除
		return request("/liveapi/shoppingcart/del", "post", data, false);
	},
	shoppingCartCount: (data) => {
		//购物车数量
		return request("/liveapi/shoppingcart/count", "get", data, false);
	},
	orderSub: (data) => {
		//订单提交
		return request("/liveapi/orderinfo", "post", data, true);
	},
	orderPage: (data) => {
		//订单列表
		return request("/liveapi/orderinfo/page", "get", data, false);
	},
	orderGet: (id) => {
		//订单详情查询
		return request("/liveapi/orderinfo/" + id, "get", null, false);
	},
	orderCancel: (id) => {
		//订单确认取消
		return request("/liveapi/orderinfo/cancel/" + id, "put", null, true);
	},
	orderReceive: (id) => {
		//订单确认收货
		return request("/liveapi/orderinfo/receive/" + id, "put", null, true);
	},
	orderDel: (id) => {
		//订单删除
		return request("/liveapi/orderinfo/" + id, "delete", null, false);
	},
	orderCountAll: (data) => {
		//订单计数
		return request("/liveapi/orderinfo/countAll", "get", data, false);
	},
	orderLogisticsGet: (logisticsId) => {
		//订单物流查询
		return request("/liveapi/orderinfo/orderlogistics/" + logisticsId, "get", null, false);
	},
	unifiedOrder: (data) => {
		//下单接口
		return request("/liveapi/orderinfo/unifiedOrder", "post", data, true);
	},
	userAddressPage: (data) => {
		//用户收货地址列表
		return request("/liveapi/useraddress/page", "get", data, false);
	},
	userAddressSave: (data) => {
		//用户收货地址新增
		return request("/liveapi/useraddress", "post", data, true);
	},
	userAddressDel: (id) => {
		//用户收货地址删除
		return request("/liveapi/useraddress/" + id, "delete", null, false);
	},
	userCollectAdd: (data) => {
		//用户收藏新增
		return request("/liveapi/usercollect", "post", data, true);
	},
	userCollectDel: (id) => {
		//用户收藏删除
		return request("/liveapi/usercollect/" + id, "delete", null, false);
	},
	userCollectPage: (data) => {
		//用户收藏列表
		return request("/liveapi/usercollect/page", "get", data, false);
	},
	userFootprintPage: (data) => {
		//用户足迹列表
		return request("/liveapi/userfootprint/page", "get", data, false);
	},
	goodsAppraisesAdd: (data) => {
		//商品评价新增
		return request("/liveapi/goodsappraises", "post", data, true);
	},
	goodsAppraisesPage: (data) => {
		//商品评价列表
		return request("/liveapi/goodsappraises/page", "get", data, false);
	},
	qrCodeUnlimited: (data) => {
		//获取小程序二维码
		return request("/liveapi/wxqrcode/unlimited", "post", data, true);
	},
	orderItemGet: (id) => {
		//查询订单详情
		return request("/liveapi/orderitem/" + id, "get", null, false);
	},
	orderRefundsSave: (data) => {
		//发起退款
		return request("/liveapi/orderrefunds", "post", data, true);
	},
	userInfoGet: () => {
		//查询商城用户信息
		return request("/liveapi/userinfo", "get", null, false);
	},
	userInfoUpdate: (data) => {
		//修改商城用户
		return request("/liveapi/userinfo", "put", data, true);
	},
	pointsRecordPage: (data) => {
		//查询积分记录
		return request("/liveapi/liverewardrecord/page2", "get", data, false);
	},
	pointsConfigGet: () => {
		//查询积分配置
		return request("/liveapi/pointsconfig", "get", null, false);
	},
	couponUserSave: (data) => {
		//电子券用户领取
		return request("/liveapi/couponuser", "post", data, true);
	},
	couponUserPage: (data) => {
		//电子券用户列表
		return request("/liveapi/couponuser/page", "get", data, false);
	},
	couponInfoPage: (data) => {
		//电子券列表
		return request("/liveapi/couponinfo/page", "get", data, false);
	},
	bargainInfoPage: (data) => {
		//砍价列表
		return request("/liveapi/bargaininfo/page", "get", data, false);
	},
	bargainInfoGet: (data) => {
		//砍价详情
		return request("/liveapi/bargaininfo", "get", data, true);
	},
	bargainUserSave: (data) => {
		//发起砍价
		return request("/liveapi/bargainuser", "post", data, true);
	},
	bargainCutPage: (data) => {
		//帮砍记录
		return request("/liveapi/bargaincut/page", "get", data, true);
	},
	bargainUserGet: (id) => {
		//砍价记录详情
		return request("/liveapi/bargainuser/" + id, "get", null, false);
	},
	bargainUserPage: (data) => {
		//砍价记录列表
		return request("/liveapi/bargainuser/page", "get", data, true);
	},
	bargainCutSave: (data) => {
		//砍一刀
		return request("/liveapi/bargaincut", "post", data, true);
	},
	listEnsureBySpuId: (data) => {
		//通过spuID，查询商品保障
		return request("/liveapi/ensuregoods/listEnsureBySpuId", "get", data, true);
	},
	grouponInfoPage: (data) => {
		//拼团列表
		return request("/liveapi/grouponinfo/page", "get", data, false);
	},
	grouponInfoGet: (id) => {
		//拼团详情
		return request("/liveapi/grouponinfo/" + id, "get", null, true);
	},
	grouponUserPageGrouponing: (data) => {
		//拼团中分页列表
		return request("/liveapi/grouponuser/page/grouponing", "get", data, true);
	},
	grouponUserPage: (data) => {
		//拼团记录列表
		return request("/liveapi/grouponuser/page", "get", data, true);
	},
	grouponUserGet: (id) => {
		//拼团记录详情
		return request("/liveapi/grouponuser/" + id, "get", null, false);
	},

	seckillhallList: (date) => {
		//秒杀会场时间列表
		return request("/liveapi/seckillhall/list?hallDate=" + date, "get", null, false);
	},
	seckillinfoPage: (data) => {
		//秒杀列表
		return request("/liveapi/seckillinfo/page", "get", data, false);
	},
	seckillInfoGet: (seckillHallInfoId) => {
		//秒杀详情
		return request("/liveapi/seckillinfo/" + seckillHallInfoId, "get", null, true);
	},
	wxTemplateMsgList: (data) => {
		//订阅消息列表
		return request("/liveapi/wxtemplatemsg/list", "post", data, false);
	},
	liveRoomInfoList: (data) => {
		//获取直播房间列表
		return request("/liveapi/wxmalive/roominfo/list", "get", data, true);
	},
	customerServiceList: (shopId) => {
		//客服列表
		return request("/liveapi/customerservice/list/" + shopId, "get", null, false);
	},
	pagedevise: (pageType) => {
		//首页组件配置
		return request("/liveapi/pagedevise?pageType=" + pageType, "get", null, false);
	},
	pagedeviseShop: (shopId) => {
		// 店铺组件配置
		return request("/liveapi/pagedevise?pageType=2&shopId=" + shopId, "get", null, false);
	},
	articlePage: (data) => {
		//文章列表
		return request("/liveapi/articleinfo/page", "get", data, false);
	},
	articleGet: (id) => {
		//文章详情
		return request("/liveapi/articleinfo/" + id, "get", null, false);
	},
	articleCategoryPage: (data) => {
		//文章分类列表
		return request("/liveapi/articlecategory/page", "get", data, false);
	},
	userSign: (data) => {
		//积分签到
		return request("/liveapi/signrecord/user", "post", data, false);
	},
	getSignRecord: (data) => {
		//签到记录查询
		return request("/liveapi/signrecord/user", "get", data, false);
	},
	signConfigPage: (data) => {
		//获取签到积分记录
		return request("/liveapi/signconfig/page", "get", data, false);
	},
	distributionConfig: () => {
		//分销设置查询
		return request("/liveapi/distributionconfig", "get");
	},
	distributionuser: () => {
		//分销员查询
		return request("/liveapi/distributionuser", "get");
	},
	distributionuserPage: (data) => {
		//分销员查询
		return request("/liveapi/distributionuser/page", "get", data);
	},
	distributionorderPage: (data) => {
		//分销订单分页
		return request("/liveapi/distributionorder/page", "get", data);
	},
	distributionorderFrozenAmount: (data) => {
		//获取当前分销员的冻结金额
		return request("/liveapi/distributionorder/frozenAmount", "get", data);
	},
	distributionPromotionPage: (data) => {
		//分销 推广人统计
		return request("/liveapi/userinfo/page", "get", data);
	},
	userwithdrawRecordSave: (data) => {
		//分销 申请提现
		return request("/liveapi/userwithdrawrecord", "post", data, true);
	},
	userwithdrawRecordUpdate: (data) => {
		//分销 提现申请修改
		return request("/liveapi/userwithdrawrecord", "put", data, true);
	},
	userwithdrawRecordPage: (data) => {
		//分销 提现记录
		return request("/liveapi/userwithdrawrecord/page", "get", data);
	},
	userwithdrawRecord: (id) => {
		//分销 提现记录详情
		return request("/liveapi/userwithdrawrecord/" + id, "get", null);
	},
	userRecord: () => {
		//分销 用户消费总额记录
		return request("/liveapi/userrecord", "get", null);
	},
	wxAppConfig: (id) => {
		//获取wx一件授权的component_appid
		return request("/liveapi/wxapp/" + id, "get", null);
	},
	userAppraisesPage: (data) => {
		//我的评价
		return request("/liveapi/goodsappraises/page/user", "get", data);
	},
	goodsSpuListByIds: (data) => {
		//根据id集合商品查询
		if (data && data.length > 0) {
			return request("/liveapi/goodsspu/listbyids", "post", data, false);
		} else {
			return new Promise((resolve, reject) => {
				resolve({
					data: [],
				});
			});
		}
	},
	userOnlineHeartbeat: (data) => {
		// 接收商城用户心跳
		return request("/liveapi/useronline/heartbeat", "get", data);
	},
	shopApply: (data) => {
		// 店铺入驻——店铺信息验证
		return request("/mall/shopapply/addedit", "put", data);
	},
	shopApplyQuery: (data) => {
		// 店铺入驻——根据编号(id)查询
		return request("/mall/shopapply/one", "get", data);
	},
	shopApplyShopInfoValidate: (data) => {
		// 店铺入驻——店铺信息验证
		return request("/mall/shopinfo/count", "get", data);
	},
	shopApplyLoginUserValidate: (data) => {
		// 店铺入驻——店长登录账号信息验证
		return request("/upms/user/count", "get", data);
	},
	imLogin: (data) => {
		//im 登录
		return request("/liveapi/im/login", "post", data, false);
	},
	imRegister: (data) => {
		//im 注册
		return request("/liveapi/im/register", "post", data, false);
	},
	getDefaultAddress: (data) => {
		//用户收货地址列表
		return request("/liveapi/useraddress/getDefaultAddress", "get", data, false);
	},
	userAddressPage: (data) => {
		//用户收货地址列表
		return request("/liveapi/useraddress/page", "get", data, false);
	},
	getUserzeropay: (id) => {
		//支付时查询是否尅 0元付款
		return request("/liveapi/userzeropay/getByUserId/" + id, "get", null, true);
	},
	getInvoicePage: (data) => {
		//获取发票分页
		return request("/liveapi/orderinvoice/page", "get", data, false);
	},
	addInvoice: (data) => {
		//新增发票
		return request("/liveapi/orderinvoice", "post", data, false);
	},
	putInvoice: (data) => {
		//修改发票
		return request("/liveapi/orderinvoice", "put", data, false);
	},
	delInvoice: (id) => {
		//删除发票
		return request("/liveapi/orderinvoice/" + id, "delete", null, false);
	},
	deltailInvoice: (id) => {
		//发票详情
		return request("/liveapi/orderinvoice/" + id, "get", null, false);
	},
	fenxiaoconfig: (data) => {
		//修改发票
		return request("/liveapi/fenxiaoconfig", "get", data, false);
	},
	getHomeAd: (id) => {
		//首屏广告
		return request("/liveapi/popupinfo/", "get", null, false);
	},
	wxgetSnowflake: (data) => {
		//获取图片上传id
		return request("/liveapi/api/ma/prescriptions/getSnowflake", "post", data, false);
	},
	prescriptioninfo: (data) => {
		//获取图片上传id
		return request("/liveapi/prescriptioninfo", "post", data, false);
	},
	getMyPoint: () => {
		return request(`/liveapi/pointsrecord/getMyPoint`, "get", null);
	},
	goodspointsGet: (data) => {
		//查询积分商城商品
		return request("/liveapi/goodspoints/page", "get", data, false);
	},
	subPointOrder: (data) => {
		//积分商城兑换
		return request("/liveapi/goodspoints/subPointOrder", "post", data, true);
	},
	getQrCodeContent: (data) => {
		//积分商城兑换
		return request("/pres/qrcode/getQrCodeContent", "post", data, true);
	},
	qrcodeSave: (data) => {
		//积分商城兑换
		return request("/liveapi/qrcode/save", "post", data, true);
	},
	qrcodePage: (data) => {
		//积分商城兑换
		return request("/liveapi/qrcode/page", "get", data, false);
	},
	getShopinfoList: (data) => {
		//店铺列表
		return request("/liveapi/shopinfo/list", "get", data, false);
	},
	getSwiper: (data) => {
		//首页轮播
		return request("/liveapi/livebanner/list", "get", data, false);
	},
	getliveList: (data) => {
		//首页直播列表
		return request("/liveapi/liveinfo/page", "get", data, true);
	},
	getliveInfo: (id) => {
		//首页直播列表
		return request("/liveapi/liveinfo/" + id, "get", true);
	},
	liveusertopicrecord: (data) => {
		//提交答题
		return request("/liveapi/liveusertopicrecord", "post", data, true);
	},
	liveuserrecord: (data) => {
		//用户进出直播间记录新增
		return request("/liveapi/liveuserrecord", "post", data, false);
	},
	getSceneinfo: (id) => {
		return request("/liveapi/sceneinfo/" + id, "get", null, false);
	},

	//直播设置
	liveusersetrewardsaveAll: (data) => {
		return request("/liveapi/liveusersetreward/saveAll", "post", data, false);
	},
	//绑定团长
	bindManager: (data) => {
		return request("/liveapi/userinfo/bindManager", "get", data, false);
	},
	getLiveSetting: (data) => {
		return request("/liveapi/liveusersetreward/getAll", "post", data, true);
	},
	//绑定用户
	liveBandUser: (data) => {
		return request("/liveapi/userbindlive", "post", data, false);
	},
	livepritmplSave: (data) => {
		return request("/livepritmpl/save", "post", data, true);
	},
	liveGetCoupon: (data) => {
		return request("/liveapi/livecouponrecord", "post", data, true);
	},
	liveSetDraw: (data) => {
		return request("/liveapi/livelotteryjoinrecord", "post", data, true);
	},
	livecouponrecord: (data) => {
		//优惠券获取
		return request("/liveapi/livecouponrecord/page", "get", data, true);
	},
	livelotteryjoinrecord: (data) => {
		//奖品领取记录
		return request("/liveapi/livelotteryjoinrecord/page", "get", data, true);
	},
	liverewardrecord: (data) => {
		//红包积分领取记录
		return request("/liveapi/liverewardinfo/page", "get", data, true);
	},
	tzLiverewardrecord: (data) => {
		//红包积分领取记录
		return request("/liveapi/liveusersetreward/page", "get", data, true);
	},
	tzLvecouponrecord: (data) => {
		//优惠券获取
		return request("/liveapi/livecouponinfo/page", "get", data, true);
	},
	tzLivelotteryjoinrecord: (data) => {
		//奖品领取记录
		return request("/liveapi/livelotteryset/page", "get", data, true);
	},
	ivelotteryPut: (data) => {
		//奖品核销
		return request("/liveapi/livelotteryjoinrecord", "put", data, true);
	},
	couponCheckPut: (data) => {
		//优惠券核销
		return request("/liveapi/livecouponrecord/couponCheck", "post", data, true);
	},
	getPlayback: (data) => {
		//优惠券核销
		return request("/liveapi/liveinfo/getPlayback", "post", data, true);
	},
	subLiveWxPay: (data) => {
		//充值
		return request("/liveapi/livewxpay/subLiveWxPay", "post", data, true);
	},
	getRechargeList: (data) => {
		//充值记录
		return request("/liveapi/livewxpay/page", "get", data, true);
	},
	getLivewxrefundList: (data) => {
		//充值记录
		return request("/liveapi/livewxrefund/page", "get", data, true);
	},
	liveOnlineUser: (data) => {
		//充值记录
		return request("/liveapi/liveOnlineUser/page", "get", data, true);
	},
	liverewardrefundPage: (data) => {
		//回滚红包记录
		return request("/liveapi/liverewardrefund/page", "get", data, true);
	},
	subscriptionTemplate: (data) => {
		//订阅模板
		return request("/liveapi/livewxmsg/list", "get", data, true);
	},
	livepritmpl: (data) => {
		//订阅模板成功回调
		return request("/liveapi/livepritmpl", "post", data, true);
	},
	getReGetMoney: (data) => {
		//回滚红包
		return request("/liveapi/liveusersetreward/getReGetMoney", "post", data, true);
	},
	getLiveUserSetReward: (data) => {
		//获取直播间未领取红包记录
		return request("/liveapi/liveusersetreward/getLiveUserSetReward", "get", data, true);
	},
	livewxrefund: (data) => {
		//提现
		return request("/liveapi/livewxrefund", "post", data, true);
	},
	editPoints: (data) => {
		//提现
		return request("/liveapi/userinfo/handPoints", "post", data, true);
	},
	liveblacklistuser: (data) => {
		return request("/liveapi/liveblacklistuser", "post", data, true);
	},
	liveUserDataPage: (data) => {
		//用户数据分页
		return request("/liveapi/excel/view/liveUserData/page", "get", data, true);
	},
	liveAndTzDataPage: (data) => {
		//直播团长数据分页
		return request("/liveapi/excel/view/liveAndTzData/page", "get", data, true);
	},
	liveAndUserDataPage: (data) => {
		//直播团长数据分页
		return request("/liveapi/excel/view/liveAndUserData/page", "get", data, true);
	},
	getBangList: (data) => {
		//邀请榜
		return request("/liveapi/userbindlive/listTzUser", "get", data, true);
	},
	liveUserDataExport: (data) => {
		//用户数据导出
		return request("/liveapi/excel/export/liveUserData", "get", data, false, true);
	},
	tzBindRecord: (data,current) => {
		return request(`/liveapi/userbindlive/tzBindRecord?current=${current}`, "post", data,true);
	},
	getLiveStatus: (data) => {
		return request(`/liveapi/liveinfo/getLiveStatus?liveId`, "get", data, true);
	}
};
